﻿//using SharpSoft.Documentation.Html.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpSoft.Documentation.Html.CSS
{
    /// <summary>
    /// 类名选择器
    /// </summary>
    public struct ClassRule : IRule
    {
        public ClassRule(string classname)
        {
            _ClassName = classname;
            this._RelationType = CssSelectorRuleRelationType.And;
        }

        private string _ClassName;

        public string ClassName
        {
            get { return _ClassName; }
            set { _ClassName = value; }
        }
        private CssSelectorRuleRelationType _RelationType;
        /// <summary>
        /// 获取或设置当前规则与下一个规则的关系，对于选择器中的最后一个规则，此设置无效
        /// </summary>
        public CssSelectorRuleRelationType RelationType
        {
            get { return _RelationType; }
            set { _RelationType = value; }
        }

        public override string ToString()
        {
            return "类名规则：" + ClassName;
        }

        //public INodeFilter ToNodeFilter()
        //{
        //    return new AttributeRegexFilter("class", string.Format("^{0} | {0}$| {0} |^{0}$", ClassName),true);
        //}
    }
}
